def method(nums):
    d = {}
    for n in nums:
        if n not in d:
            d[n] = 0
        d[n] += 1
    ans = []
    for k in d:
        # 必须是大于2的偶数
        if d[k] < 2 or d[k] % 2 != 0:
            return -1
        for _ in range(d[k] // 2):
            ans.append(k)
    return ans

_ = int(input())
nums = [int(x) for x in input().split()]
ans = method(nums)
if ans == -1:
    print(-1)
else:
    s = ' '.join([str(x) for x in ans])
    print(s)
    print(s)
